package com.core.preprocess;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * create by yongli on 2021-09-23 15:30
 */
@Configuration
public class IntercepterConfig implements WebMvcConfigurer {
    @Autowired
    UserIntercepter userIntercepter;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 可以加入认证信息
        // 这样一个配置就能搞定，是一个技法问题
        // 不是比谁聪明，而是比谁更熟练
        registry.addInterceptor(userIntercepter).addPathPatterns("/user/**").excludePathPatterns("/user/info");
    }
}
